﻿<div ng-controller="WalletHistoryController">    
    <div class="row">
        <div class="col-xs-12 col-md-12">          
            <div class="widget">            
                <div class="widget-body">
                    <div class="row">
                        <div class="well with-header" style="padding:20px">
                            <div class="header bg-themeprimary">
                                <div class="col-sm-6" style="padding-left:0px">
                                   History {{NameWallet}}
                                </div>
                                <div class="col-sm-6">
                                    <h5 class=" text-align-right">
                                        Total
                                        <span class="badge badge-danger badge-square"><i class="glyphicon glyphicon-usd"></i>  {{Balance|number}}</span>
                                    </h5>
                                </div>
                            </div>
                            </div>
                        </div>
                    <div class="flip-scroll">
                        <!--<div class="btn-group pull-right" style="margin-bottom:10px;">                          
                            <span class="btn btn-sm" ng-click="popup('','FormCashOutModal','WalletCashoutModalInstanceCtrl','sm')" ng-if="true"><i class="fa fa-plus-circle"></i> Cashout</span>
                        </div>-->
                        <table class="table table-bordered table-striped table-condensed flip-content">
                            <thead class="flip-content bordered-palegreen">
                                <tr>                                    
                                    <th>
                                        Wallet
                                    </th>
                                    <th class="numeric">
                                        Amount
                                    </th>
                                    <th class="numeric">
                                        Date
                                    </th>                                    
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="data in Walletlists">
                                    <td>
                                        {{data.Transaction}}
                                    </td>                                 
                                    <td class="numeric">
                                        <i class="glyphicon glyphicon-bitcoin"></i> {{data.Amount|number }}
                                    </td>
                                    <td class="numeric">
                                        {{data.Date | date:'dd-MM-yyyy'}}
                                    </td>                                   
                                </tr>                                
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--Success Modal Templates-->
    <script type="text/ng-template" id="WarningModal">
        <div class="modal-header">
            <i class="glyphicon glyphicon-check"></i>
        </div>
        <div class="modal-title">{{title}}</div>
        <div class="modal-body">
            {{ messeger }}
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-success" ng-click="ok()">OK</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
    <script type="text/ng-template" id="FormCashOutModal">
        <div class="modal-header">
            <strong>CashOut</strong>
        </div>
        <div class="modal-body">
            <div class="loginbox">
                <p class="text-danger">{{messeger}}</p>
                <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                    <div class="form-group">
                        <label>Payment Method</label>
                        <ui-select ng-model="payment.selected">
                            <ui-select-match placeholder="Select or search a payment in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in PaymentMethod | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.PaymentId=payment.selected.Id;""}}
                    </div>
                    <div class="form-group">
                        <label>Amount (฿)</label>
                        <input class="form-control" ng-model="data.Amount" type="text" ng-pattern="/^[0-9.]+$/" ng-change="doProcess(data)">
                    </div>
                    <div class="form-group">
                        <label>Fee {{data.Fee}}%</label>
                        <input class="form-control" ng-model="data.Fee" placeholder="Fee" type="text" readonly>
                    </div>
                    <div class="form-group">
                        <label>After Fee</label>
                        <input class="form-control" ng-model="data.After" placeholder="Amount" type="text" readonly>
                    </div>
                    <div class="form-group">
                        <label>Chose Wallet</label>
                        <ui-select ng-model="wallet.selected">
                            <ui-select-match placeholder="Select or search a wallet in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in WalletList | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.Wallet=wallet.selected.Id;""}}
                    </div>
                </form>
            </div>
        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doCashout(data)" ng-disabled="processing">Cash Out</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
</div>